<html>
<head><meta charset="utf-8"><title>Using ast::Visitor to visit expanded proc_macro · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20ast.3A.3AVisitor.20to.20visit.20expanded.20proc_macro.html">Using ast::Visitor to visit expanded proc_macro</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="240390641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20ast%3A%3AVisitor%20to%20visit%20expanded%20proc_macro/near/240390641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20ast.3A.3AVisitor.20to.20visit.20expanded.20proc_macro.html#240390641">(May 26 2021 at 20:59)</a>:</h4>
<p>Currently in rustdoc, we only load dependencies that are needed for the intra doc links. However we had a regression (<a href="https://github.com/rust-lang/rust/issues/84738">https://github.com/rust-lang/rust/issues/84738</a>) because of that. The problem is that if an intra doc link is generated by a proc macro, we currently don't see it. Is there a way with this visitor to "walk through" the expanded proc macro?</p>
<p>cc <span class="user-mention" data-user-id="232545">@Joshua Nelson</span></p>



<a name="240450650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Using%20ast%3A%3AVisitor%20to%20visit%20expanded%20proc_macro/near/240450650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Using.20ast.3A.3AVisitor.20to.20visit.20expanded.20proc_macro.html#240450650">(May 27 2021 at 11:19)</a>:</h4>
<p>Extra info: we use <code>let parts = abort_on_err(queries.expansion(), sess).peek();</code>, so I guess the expansion is done already. If I then try to do <code>resolver.borrow_mut().access(|resolver| resolver.resolve_crate(&amp;krate));</code>, then I get a panic:</p>
<div class="codehilite"><pre><span></span><code>thread &#39;rustc&#39; panicked at &#39;path resolved multiple times (PartialRes { base_res: PrimTy(Int(I128)), unresolved_segments: 0 } before, PartialRes { base_res: PrimTy(Int(I128)), unresolved_segments: 0 } now)&#39;, compiler/rustc_resolve/src/lib.rs:2826:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic
</code></pre></div>
<p>So I guess I misunderstood the problem maybe...</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>